package test;

import java.io.File;
import java.io.IOException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

public class XML {
	public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException {
			             File f = new File("d:/file.xml");  
			             DocumentBuilderFactory factory = DocumentBuilderFactory  
			                                  .newInstance();  
			                        DocumentBuilder builder = factory.newDocumentBuilder();  
			                       Document doc = builder.parse(f);  
			                      NodeList nl= doc.getElementsByTagName("response");
			                      for (int i = 0; i < nl.getLength(); i++) {  
			                    	                  System.out.println("|| is_success:  |"  
			                    	                          + doc.getElementsByTagName("is_success").item(i)  
			                    	                                  .getFirstChild().getNodeValue());  
			                    	                 System.out.println("||message:  |"  
			                    	                          + doc.getElementsByTagName("message").item(i)  
			                    	                                .getFirstChild().getNodeValue());  
			                    	                 System.out.println("-------------------------------------------------");            }  
			             
	}

}
